Skip to content

Conversation

@cscguochang
Copy link

Summary

This PR addresses Issue #626 by adding a foundational tutorial for using SQLModel with Async. It also fixes incorrect code examples in the AsyncSession.execute and AsyncSession.exec docstrings where await was used in a way that would raise an AttributeError.

Key Changes

  • Created docs/tutorial/async/index.md.
  • Corrected await session.exec().all() to (await session.exec()).all() in docstrings.

Verified with actual execution logic.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

📝 Docs preview

Last commit a1e82c3 at: https://00ece0bc.sqlmodel.pages.dev

Modified Pages

Copy link
Member

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cscguochang, thanks for your interest and efforts!

I think adding async docs requires more complex approach (re-exporting necessary function and types, probably adjusting some of them, explaining some concepts, writing complete code examples, all code examples should be covered by tests).


```Python
heroes = await session.execute(select(Hero)).scalars().all()
heroes = (await session.execute(select(Hero))).scalars().all()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have PR for this: #1643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants